<template>
  <view class="discover-painting">
    <view class="header">
      <text class="title">绘画榜</text>
    </view>
    
    <view class="content">
      <view class="painting-list">
        <view class="painting-item" v-for="(item, index) in paintingList" :key="index" @click="goToPainting(item)">
          <view class="rank">{{ index + 1 }}</view>
          <view class="image-placeholder">{{ item.emoji }}</view>
          <view class="info">
            <text class="name">{{ item.name }}</text>
            <text class="desc">{{ item.description }}</text>
            <text class="author">by {{ item.author }}</text>
          </view>
          <view class="stats">
            <text class="likes">{{ item.likes }}❤️</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      paintingList: [
        { id: 1, name: '梦幻星空', emoji: '🌌', description: '浪漫的星空夜景，充满想象力的艺术创作', author: 'AI艺术家', likes: 1250 },
        { id: 2, name: '春日花园', emoji: '🌸', description: '繁花似锦的春日景象，色彩斑斓', author: '创意大师', likes: 980 },
        { id: 3, name: '未来城市', emoji: '🏙️', description: '科技感十足的未来都市景观', author: '未来派', likes: 756 },
        { id: 4, name: '海洋深处', emoji: '🐠', description: '神秘的海底世界，生物多样性', author: '海洋探索者', likes: 634 },
        { id: 5, name: '童话森林', emoji: '🌲', description: '充满魔法的森林场景，童话风格', author: '童话画家', likes: 521 }
      ]
    }
  },
  
  methods: {
    goToPainting(item) {
      // 跳转到绘画详情页面
      uni.navigateTo({
        url: `/pages/painting-detail/painting-detail?id=${item.id}&name=${item.name}`
      })
    }
  }
}
</script>

<style scoped>
.discover-painting {
  min-height: 100vh;
  background-color: var(--primary-bg);
  padding-bottom: 50px;
}

.header {
  padding: 20px 16px;
  background-color: var(--secondary-bg);
  border-bottom: 1px solid var(--border-color);
}

.title {
  font-size: 26px;
  font-weight: bold;
  color: var(--text-primary);
}

.content {
  padding: 16px;
}

.painting-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.painting-item {
  display: flex;
  align-items: center;
  padding: 16px;
  background-color: var(--secondary-bg);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.painting-item:active {
  background-color: rgba(240, 217, 181, 0.1);
}

.rank {
  width: 32px;
  height: 32px;
  background-color: var(--accent-color);
  color: #333;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  margin-right: 16px;
}

.image-placeholder {
  width: 60px;
  height: 60px;
  background-color: rgba(240, 217, 181, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  margin-right: 16px;
}

.info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.author {
  font-size: 14px;
  color: var(--accent-color);
}

.stats {
  text-align: right;
}

.likes {
  font-size: 16px;
  color: var(--error-color);
  background-color: rgba(244, 67, 54, 0.1);
  padding: 4px 8px;
  border-radius: 12px;
}
</style>
